﻿@model int
@if (Model > 0)
{
    <table class="table table-striped table-bordered dTableR">
        <thead>
            <tr>
                <th>
                    Driver 
                </th>
                <th>
                    DATE LEASED
                </th>
                <th>
                    Inspection expiration
                </th>
            </tr>
        </thead>
        <tbody>
        @{
                var db = NationalIT.DB.Entities;
                var lst = db.Equipment.Where(m => m.ID == Model && m.Driver!=null);
                NationalIT.Driver_Info driver = null;
            }
            @foreach (var item in lst)
            {
                driver = db.Driver_Info.FirstOrDefault(m => m.ID == item.Driver);
                <tr class="rowlink">
                    <td>
                        @(driver != null ? driver.First_name + " " + driver.Last_name : null)
                    </td>
                    <td>
                        @String.Format("{0:MM/dd/yyyy}", item.DATE_LEASED)
                    </td>
                    <td>
                        @String.Format("{0:MM/dd/yyyy}", item.Inspection_Expiration)
                    </td>
                </tr>
            }
        </tbody>
    </table>
}
else
{
    <h5>
    There is no driver associated with this onwer 
    </h5>
}